<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>Title</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<form class="layui-form" action="{:url('Project/items')}" method="post">
    <h3 style="text-align: center;margin-top: 3%;margin-bottom: 2%"><b>工程项目</b></h3>
    <div class="layui-form-item">
        <div style=" margin-left: 3%" class="layui-inline">
            <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                审批流程：
            </lable>
            <div class="layui-input-inline">
                <select id="flow_id" name="project_flow_id">
                    {volist name="ProjectFlow" id="vo"}
                    <option value="{$vo.id}">{$vo.flow}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div style=" margin-left: 3%" class="layui-inline">
            <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                选择项目名称：
            </lable>
            <div class="layui-input-inline">
                <select id="id" name="project_id">
                    {volist name="ProjectName" id="item"}
                    <option value="{$item.id}">{$item.project_name}</option>
                    {/volist}
                </select>
            </div>
        </div>
    </div>
<div style="margin: auto">
    <table class="layui-table" lay-size="lg">
        <col width="180">
        <col width="320">
        <tr>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 10px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 10px" class="layui-form-label">进度名称</label>
                    <div class="layui-input-block">
                        <input lay-verify="required" class="layui-input" id="schedule_name" type="text" name="schedule_name">
                    </div>
                </div>
            </td>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 10px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 10px" class="layui-form-label">支付金额</label>
                    <div class="layui-input-block">
                        <input lay-verify="required|number" class="layui-input" type="text" name="money">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 10px;" class="layui-form-item">
                    <label style="width: 100px;padding-top: 0;padding-bottom: 0" class="layui-form-label">占合同总金额的百分比</label>
                    <div class="layui-input-block">
                        <input lay-verify="required" style="" class="layui-input" type="text" name="money_rate">
                    </div>
                </div>
            </td>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 10px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 10px" class="layui-form-label">支付日期</label>
                    <div class="layui-input-block">
                        <input lay-verify="required" class="layui-input" id="pay_time" type="text" placeholder="yyyy-MM-dd HH:mm:ss" name="project_pay_time">
                    </div>
                </div>
            </td>
        </tr>

        <tr>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 10px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 0;padding-bottom: 0" class="layui-form-label">追加/扣除款额</label>
                    <div class="layui-input-block">
                        <input lay-verify="required|number" class="layui-input" type="text" name="additional_deductions">
                    </div>
                </div>
            </td>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 10px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 0;padding-bottom: 0" class="layui-form-label">工程进度地址</label>
                    <div class="layui-input-block">
                        <input lay-verify="required" class="layui-input" type="text" name="schedule_address">
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div style="padding-top: 13px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 3px;padding-bottom: 0" class="layui-form-label">发票号码</label>
                    <div class="layui-input-block">
                        <input lay-verify="required" class="layui-input" type="text" name="bill">
                    </div>
                </div>
            </td>
            <td valign="center" align="center" style="text-align: center" colspan="2">
                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>
                    <div class="layui-input-block">
                        <input lay-verify="required" class="layui-input" name="created_time" id="time" placeholder="yyyy-MM-dd HH:mm:ss" type="text">
                    </div>
                </div>
            </td>
        </tr>
        <tr style="height: auto">
            <td valign="center" align="center" style="text-align: center" colspan="4">
                <div style="padding-top: 10px" class="layui-form-item">
                    <label style="width: 100px;padding-top: 10px;padding-bottom: 0" class="layui-form-label">付款内容</label>
                    <div class="layui-input-block">
                        <textarea lay-verify="required" placeholder="请输入内容" class="layui-input" type="text" name="project_pay_info"></textarea>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</div>

    <div style="margin-left: 600px;margin-top: 30px;
margin-bottom: 100px" class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</body>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var laydate = layui.laydate;
        var form = layui.form;
        //日期时间选择器
        laydate.render({
            elem: '#time'
            , type: 'datetime'
        });
        //日期时间选择器
        laydate.render({
            elem: '#pay_time'
            , type: 'datetime'
        });
//监听提交
        //监听自定义验证
        form.verify({
            number: [/^[0-9]*$/ , '金额只能为数字']
        });
        form.on('submit(demo1)', function (data) {
            layer.alert(JSON.stringify(data.field), {
             title: '最终的提交信息'
             });
            var datas = JSON.stringify(data.field);
            //console.log(datas);
            $.ajax({
                type: "post",
                url: "{:url('Project/schedule_approve_sub')}",
                data: {'data': datas},
                dataType: "json",
                success: function (res) {
                    //alert(res);
                    console.log(res);
                    if (res == 1) {
                        layer.msg('添加成功');
                        window.setTimeout("window.location=\"{:url('Myself/myselfapprove')}\"", 2000);
                        //window.location.href="{:url('Stafflist/index')}"
                    } else {
                        layer.msg('提示：添加失败');
                    }
                }
            });
            return false;
        });
    });
</script>
</html>